﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CFR.Silverlight.Scheduling
{
    public class Event
    {
        public virtual string ShortTimeString
        {
            get
            {
                if (IsAllDayEvent)
                    return null;


                string start = (StartDate.Hour == 12 || StartDate.Hour == 0) ? "12" : ((StartDate.Hour) % 12).ToString();

                if (StartDate.Minute != 0)
                    start += ":" + StartDate.Minute.ToString("00");

                start += (StartDate.Hour >= 11) ? "p" : "a";

                string end = (EndDate.Hour == 12 || EndDate.Hour == 0) ? "12" : ((EndDate.Hour) % 12).ToString();

                if (EndDate.Minute != 0)
                    end += ":" + EndDate.Minute.ToString("00");

                end += (EndDate.Hour >= 11) ? "p" : "a";

                return start + " - " + end;

            }
        }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
        public virtual DateTime StartDate { get; set; }
        public virtual DateTime EndDate { get; set; }
        public virtual string Location { get; set; }
        public virtual Calendar Calendar { get; set; }
        public virtual bool IsAllDayEvent { get; set; }
        protected internal Guid Guid { get; set; }
        public virtual object Tag { get; set; }

        public virtual object Content { get; set; }
        public virtual DataTemplate ContentTemplate { get; set; }

        public TimeSpan Duration
        {
            get { return EndDate - StartDate; }
        }

        public Event()
        {
            Guid = Guid.NewGuid();
        }


    }
}
